package 中等.验证二叉搜索树;

public class Solution {
    public boolean isValidBST(TreeNode root) {
        return helper(root,,Integer.MAX_VALUE);
    }

    public boolean helper(TreeNode root , int minval , int maxval){
        if(root == null){
            return true;
        }

        if(root.val <= minval || root.val >= maxval){
            return false;
        }

        return helper(root.left,minval,root.val) && helper(root.right,root.val,maxval);

    }
}
